package com.ruoyi.web.controller.gis;

import com.ruoyi.base.domain.BusWaterSegment;
import com.ruoyi.base.domain.SysPermission;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.gis.service.IGisService;
import com.ruoyi.pwk.domain.BusPwkRhoutfall;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/gis")
public class GisController extends BaseController {
    @Autowired
    private IGisService gisService;

    /**
     * 查询饮用水源地、自动站、 手工断面
     */
    //@PreAuthorize("@ss.hasPermi('gis:gis:drinkwaterlist')")
    @GetMapping("/drinkwaterlist")
    public AjaxResult DrinkWaterlist(String isdrink, String ismanual, String isauto,String riverid,String countyCode) {
        List<BusWaterSegment> list = gisService.WaterSegmentlist(isdrink, ismanual, isauto, riverid, countyCode);
        return AjaxResult.success(list);
    }

    /**
     * 获取饮用水源地断面最新监测数据
     *
     * @param id
     * @return
     */
    @GetMapping("/drinkwatertoplevel")
    public AjaxResult DrinkWaterTopLevel(String id) {
        Map<String, Object> list = gisService.DrinkWaterTopLevelData(id);
        return AjaxResult.success(list);
    }

    /**
     * 获取饮用水源地断面指定时间段内数据
     * @param segmentId
     * @param itemCode
     * @param beginDate
     * @param endDate
     * @return
     */
    @GetMapping("/drinkwateritemlistbytime")
    public AjaxResult DrinkWaterItemListByTime(String segmentId,String itemCode, String beginDate, String endDate) {
        Map<String, Object> list = gisService.DrinkWaterItemListByTime(segmentId, itemCode , beginDate, endDate);
        return AjaxResult.success(list);
    }

    /**
     * 获取入河排污口点位
     *
     * @param riverid
     * @param countyCode
     * @return
     */
    @GetMapping("/rhoutfall")
    public AjaxResult rhOutFall(String riverid,String countyCode) {
        List<BusPwkRhoutfall> list = gisService.rhOutFall(riverid, countyCode);
        return AjaxResult.success(list);
    }

    /**
     * 水源地保护区概况
     *
     * @return
     */
    @GetMapping("/getdrinkwaterprotectinfo")
    public AjaxResult getdrinkwaterprotectinfo() {
        Map<String, Object> list = gisService.getdrinkwaterprotectinfo();
        return AjaxResult.success(list);
    }

    /**
     * 水源地情况分析
     * @return
     */
    @GetMapping("/getdrinkwaterqualityinfo")
    public AjaxResult getdrinkwaterqualityinfo() {
        List<Map<String, Object>> list = gisService.getdrinkwaterqualityinfo();
        return AjaxResult.success(list);
    }

    /**
     * 水源分布情况
     * @return
     */
    @GetMapping("/getdrinkwatercountyinfo")
    public AjaxResult getdrinkwatercountyinfo() {
        List<Map<String, Object>> list = gisService.getdrinkwatercountyinfo();
        return AjaxResult.success(list);
    }

    /**
     * 水源区域情况
     * @return
     */
    @GetMapping("/getdrinkwaterregioninfo")
    public AjaxResult getdrinkwaterregioninfo() {
        List<Map<String, Object>> list = gisService.getdrinkwaterregioninfo();
        return AjaxResult.success(list);
    }

    /**
     * 概览
     * @return
     */
    @GetMapping("/rhoutgk")
    private AjaxResult getRhoutSurvey(){

        return AjaxResult.success(gisService.getRhoutSurvey());
    }

    /**
     * 入河排污口类型统计
     * @param type 1-小类 2-大类
     * @return
     */
    @GetMapping("/rhoutrktype")
    private AjaxResult getRhoutBroadHeading(String type){

        return AjaxResult.success(gisService.getRhoutBroadHeading(type));
    }

    /**
     * 排污口分布
     * @param type  1-流域 2-区县
     */
    @GetMapping("/rhoutfb")
    private AjaxResult getRhoutFallType(String type){

        return AjaxResult.success(gisService.getRhoutFallType(type));
    }


}